<%@ include file="/WEB-INF/views/commonJSTL.jsp" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<fmt:message key="show.are" var="showAre" />

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
		<script type="text/javascript">
			$(document).ready(function(){	
				showForm();
			});
				
			function showForm(){
				var locality		= ("<c:out value="${s_UserPharmacy.pharmacy.locality.name}"/>").toUpperCase()+" - ";
				var region 			= ("<c:out value="${s_UserPharmacy.pharmacy.locality.region.name}"/>").toUpperCase()+" - ";
				var country 		= ("<c:out value="${s_UserPharmacy.pharmacy.locality.region.countryId.name}"/>").toUpperCase();
				var showAre 		= ("<c:out value="${showAre}"/>").toUpperCase();	
				
				var html= "";
				for (var i = 0; i < indexRow; i++) {
					if($("#tdUnit_"+i).text() != ''){
						html+=	'<div style="text-align:center; width: 182pt; font-size: 12px;font-family: arial;"> <fmt:message key="table.product"/> </div>'+  
								'<div>'+
								'	<fieldset style="width: 167pt; font-size: 0.8em;font-family: arial;">'+
								'		<legend><fmt:message key="form.detail"/></legend>'+		
								'		<center><label style="text-align:center">${s_UserPharmacy.pharmacy.name}</label></center>'+
								'		<label><fmt:message key="title.product"/>: <b> '+$("#tdName_"+i).text()+' </b></label><br/>'+		
								'		<label><fmt:message key="form.units"/>: <b> '+$("#tdUnit_"+i).text()+' </b></label><br/>'+
								'		<center><label><b><i><fmt:message key="show.thanksYourPreference"/></i></b></label></center>'+
								'	</fieldset>'+
								'</div><br/>';			
					}
				}		
				html+=			'<div style="text-align:center;border: 0.1em solid #000000;width: 182pt;font-family: arial;height: 3.9em;">'+
								'	<label> <fmt:message key="table.bill"/> <br/><br/> <fmt:message key="table.pharmacy"/> <b>" ${s_UserPharmacy.pharmacy.name} "</b> </label>'+
								'</div>'+
								'<div style="width: 182pt; text-align:center;"><img alt="imagen" src="<c:url value="/resources/images/ultrasoft.png" />" /></div>'+
								'<div style="text-align:center;width: 182pt;font-family: arial;font-size: 0.8em;">'+
								'	<label>${s_UserPharmacy.pharmacy.address}</label><br/>'+
								'	<label>TELF. ${s_UserPharmacy.pharmacy.phone}</label><br/>'+
								'	<label> '+locality+''+region+''+country+' </label><br/>'+
								'</div>'+
								'<div style="width: 182pt;text-align:center; height:2pt;">'+
								'	<label><hr/></label>'+
								'</div>'+								
								'<div style="width: 182pt;">'+								
								'	<div style="clear:both;">'+
								'		<label style="float:left;width:55%;text-align:right;"><fmt:message key="table.nit"/>: </label>'+	
								'		<label >${s_UserPharmacy.pharmacy.nit}</label>'+
								'	</div>'+
								'	<div style="clear:both;">'+
								'		<label style="float:left;width:55%;text-align:right;"><fmt:message key="table.billNro"/>: </label>'+		
								'		<label># factura</label>'+
								'	</div>'+
								'	<div style="clear:both;">'+
								'		<label style="float:left;width:55%;text-align:right;"><fmt:message key="table.authorization"/>: </label>'+	
								'		<label># Autorizacion</label>'+
								'	</div>'+								
								'</div>'+								
								'<div style="clear:left"></div>'+
								'<div style="width: 182pt;text-align:center; height:2pt;">'+
								'	<label><hr/></label>'+
								'</div>'+
								'<div style="font-size: 0.8em; height:36pt;">'+
								'	<label><fmt:message key="table.date"/>: ${dateTemp}</label><br/>'+			
								'	<label><fmt:message key="table.client"/>: <label id="_nameClientBill"></label></label><br/>'+			
								'	<label><fmt:message key="table.nitCi"/>: <label id="_nitCiBill"></label> </label><br/>'+
								'	<label><fmt:message key="table.description"/>: <fmt:message key="title.buyProductss"/></label><br/>'+
								'</div>'+
								'<br/>'+
								'<div>'+
								'	<fieldset style="width: 167pt; font-size: 0.8em;font-family: arial;">'+
								'	<legend><fmt:message key="form.detail"/></legend>'+
								'		<table class="tabla_decorado" id="mainContainerBill">'+		
								'			<thead>'+
								'				<tr class="tr_decorado">'+
								'					<th  width="40%" class="th_decoradoRowspan"><center><fmt:message key="table.product"/></center></th>'+
								'					<th  width="40%" class="th_decoradoRowspan"><center><fmt:message key="table.units"/></center></th>'+
								'					<th  width="20%" class="th_decoradoRowspan"><fmt:message key="table.amount"/></th>'+   		
								'				</tr>'+
								'			</thead>'+			
								'			<tbody>'+
								'			</tbody>'+
								'		</table>'+
								'	</fieldset>'+
								'</div>'+
								'<div style="float:left;"><label><fmt:message key="table.totalToPay"/>:</label></div>'+
								'<div style="text-align:right;width: 182pt;"><label ><div id="_amountBill"></div></label></div>'+
								'<div style="width: 182pt;font-size: 0.8em;font-family: arial;">'+
								'	<label>'+showAre+': ${literalAmount} <fmt:message key="table.bolivians"/>.</label><br/>'+
								'</div>'+
								'<div style="width: 182pt;font-size: 0.7em;font-family: arial; text-align:center">'+
								'	<label><fmt:message key="table.codeController"/>: #codigo de control </label><br/>'+
								'	<label><fmt:message key="table.emissionDeadline"/>: day/month/year</label><br/><br/>'+
								'	<label><fmt:message key="title.warningCopy"/>.</label><br/>'+
								'</div>'+
								'<div style="width: 182pt;font-size: 0.8em;font-family: arial;text-align:center;">'+
								'	<label><hr/><b><i><fmt:message key="title.thanksComeBackSoon"/></i></b><hr/></label>'+
								'</div>';
				$("#divShowFormBill").html(html);
			}
		</script>
    </head>
    <body>
    <div style="clear:both;" id="divShowFormBill"></div>		
    </body>
</html>


